package zuoye_4_14;

public class printaz extends Thread {
    private final Object lock;

    public printaz(Object lock) {
        this.lock = lock;
    }

    @Override
    public void run() {
        try {
            for (char i = 'A'; i <= 'Z'; i++) {
                synchronized (lock) {
                    System.out.print(i+" ");
                    lock.notify();
                    if (i != 'Z') {
                        lock.wait();
                    }
                }
            }
        } catch (InterruptedException e) {
            
        }
    }
}